package com.zhentao.controller;

import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.common.pojo.car.ChargeCarInfo;
import com.zhentao.service.IChargeCarInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 车辆信息表 前端控制器
 * </p>
 *
 * @author mp
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/car")
public class ChargeCarInfoController {
    @Resource
    private IChargeCarInfoService chargeCarInfoService;

    @GetMapping("/list")
    public ResponseResult list(){
        return chargeCarInfoService.select();
    }

    @GetMapping("/getOneCar")
    public ResponseResult getOneCar(@RequestParam("id") Integer id  ){
        return chargeCarInfoService.selectOneCar(id);
    }

    @PostMapping("/addCar")
    public ResponseResult addCar(@RequestBody ChargeCarInfo chargeCarInfo){
        return chargeCarInfoService.addCar(chargeCarInfo);
    }

    @PostMapping("/removeCar")
    public ResponseResult removeCar(@RequestParam("id") Integer id){
        return ResponseResult.okResult(chargeCarInfoService.removeById(id));
    }
}
